home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / HDX_BACK / HDXPRSV.502 / PART.H < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-09  |  5.2 KB  |  193 lines

  1. /* part.h */
  2.  
  3. /*
  4.  *
  5.  * Atari Hard Disk
  6.  * Boot sector and partitioning structures.
  7.  *
  8.  *----
  9.  * 24-Feb-1986 lmd   Structures from documentation.
  10.  * 15-Aug-1988 jye     Add the dynamic partition structure.
  11.  */
  12.  
  13.  
  14. /*
  15.  * Partition entry;
  16.  * There are four of these on the root sector;
  17.  * longs are in 68000 format.
  18.  */
  19.  
  20. #define DEVSET struct _devset     /* identify of each device */
  21. DEVSET    {
  22.     BYTE flg;
  23.     int  dev;
  24.     char *id;
  25. };
  26.  
  27. #define    PART struct _part    /* partition */
  28. PART {
  29.     BYTE p_flg;                /* flag byte */
  30.     BYTE p_id[3];            /* three bytes partition ID */
  31.     long p_st;                /* partition starting sector */
  32.     long p_siz;                /* partition size in sectors */
  33. };
  34.  
  35.  
  36. #define    SAVEPART struct _savepart    /* partitions the user want to keep after */
  37.                                     /* the partitioning opration  */
  38. SAVEPART {
  39.     long savest;                /* partition starting sector */
  40.     long savend;                /* partition size in sectors */
  41.     BYTE saveflg;                /* flag byte */
  42. };
  43.  
  44. #define OLDPART struct _oldpart       /* reconstruct the kept partition map */
  45.                                     /* which only include kept parttion   */
  46. OLDPART    {                             
  47.     long o_st;
  48.     long o_end;
  49.     BYTE o_done;
  50. };
  51.  
  52. #define NEWPART struct _newpart       /* reconstruct the kept partition map */
  53.                                     /* which only include kept parttion   */
  54. NEWPART    {                             
  55.     long n_st;
  56.     long n_end;
  57.     BYTE n_done;
  58. };
  59.  
  60. #define PRVHDR struct _prvhdr          /* the prevous partition header */
  61.  
  62. PRVHDR {
  63.     UWORD fatsiz;                    /* fat size */
  64.     UWORD dirsiz;                    /* director size */
  65. };
  66.  
  67. #define NEWHDR struct _newhdr          /* the new partition header */
  68.  
  69. NEWHDR {
  70.     UWORD fatsize;                    /* fat size */
  71.     UWORD dirsize;                    /* director size */
  72. };
  73.  
  74.  
  75. #define    DPART struct _dpart    /* the dynamic partition block*/
  76. DPART {
  77.     BYTE flg;                /* flag byte */
  78.     BYTE kpyes;                /* the flag tells the partition will keep */
  79.     long st;                /* the begining sector of the partition */
  80.     long siz;                /* partition size in sectors */
  81.     DPART *next;            /* the pointer point to next block */
  82. };
  83.  
  84. /*
  85.  * Bits in p_flg:
  86.  */
  87. #define    P_BOOTBIT    0x80        /* 0x80, boot this partition */
  88. #define    P_EXISTS    0x01        /* 0x01, partition exists */
  89. #define    P_NEXISTS    0x00        /* 0x00, partition does not exists */
  90.  
  91.  
  92. /*
  93.  * Format information is used by the Atari
  94.  * Hard Disk Format Utility to get default
  95.  * parameters for formatting the device.
  96.  *
  97.  * This is an image of part of the "set mode"
  98.  * command.
  99.  *
  100.  */
  101. #define    HINFO struct _hinfo    /* formatting information */
  102. HINFO {
  103.     UWORD hi_cc;            /* cylinder count MSB / LSB */
  104.     BYTE hi_dhc;            /* number of heads */
  105.     UWORD hi_rwcc;            /* reduced write current cyl */
  106.     UWORD hi_wpc;            /* write precomp cyl */
  107.     BYTE hi_lz;                /* landing zone */
  108.     BYTE hi_rt;                /* step rate code */
  109.     BYTE hi_in;                /* interleave factor */
  110.     BYTE hi_spt;            /* sectors-per-track */
  111. };
  112.  
  113.  
  114. /*
  115.  * Root sector;
  116.  * This lives on physical sector zero
  117.  * of the device, and describes the device.
  118.  *
  119.  * The structure starts at 0x200 - sizeof(RSECT).
  120.  *
  121.  * longs are in 68000 format.
  122.  *
  123.  */
  124. #define    RSECT struct _rsect    /* root sector */
  125. RSECT {
  126.     HINFO hd_info;            /* formatting information */
  127.     long hd_siz;            /* size of disk, in sectors */
  128.     PART hd_p[4];            /* four partitions */
  129.     long bsl_st;            /* start of bad sector list */
  130.     long bsl_cnt;            /* end of bad sector list */
  131.     UWORD hd_reserved;            /* (reserved word) */
  132. };
  133.  
  134.  
  135. /*
  136.  * Boot sector format.
  137.  * This is identical to that on a floppy disk.
  138.  * '*'d entries are valid values in the boot sector.
  139.  *
  140.  */
  141. #define    BOOT struct _boot
  142. BOOT {
  143.     BYTE b_bra[2];        /*    usually BRA.S to code */
  144.     BYTE b_filler[6];        /*    OEM field, "Loader" or "HDLoad" */
  145.     BYTE b_serial[3];        /*    serial number */
  146.     BYTE b_bps[2];        /* *  bytes per sector */
  147.     BYTE b_spc;            /* *  sectors per cluster */
  148.     BYTE b_res[2];        /* *  number of reserved sectors */
  149.     BYTE b_nfats;        /* *  number of FATs */
  150.     BYTE b_ndirs[2];        /* *  number of root directory entries */
  151.     BYTE b_nsects[2];        /* *  number of sectors on media */
  152.     BYTE b_media;        /* *  media descriptor flag */
  153.     BYTE b_spf[2];        /* *  number of sectors/FAT */
  154.     BYTE b_spt[2];        /*    number of sectors/track */
  155.     BYTE b_nsides[2];        /*    number of sides on media */
  156.     BYTE b_nhid[2];        /*    number of hidden sectors */
  157. };
  158.  
  159.  
  160.  
  161. /*
  162.  * `set_mode' parameter format
  163.  * (22 bytes long + 10 wasted bytes)
  164.  *
  165.  */
  166. #define    SETMODE    struct __setmode
  167. SETMODE {
  168.     BYTE smd_xxxx[3];        /* three bytes of zero */
  169.     BYTE smd_8;            /* 0x08 */
  170.     BYTE smd_yyyy[5];        /* five more zero bytes */
  171.     BYTE smd_bs[3];        /* block size MSB, MIDSB, LSB (0x000200) */
  172.     BYTE smd_1;            /* 0x01 */
  173.     BYTE smd_cc[2];        /* cylinder count MSB LSB */
  174.     BYTE smd_dhc;        /* data head count */
  175.     BYTE smd_rwc[2];        /* reduced-write cylinder MSB LSB */
  176.     BYTE smd_wpc[2];        /* write-precomp cylinder MSB LSB */
  177.     BYTE smd_lz;        /* landing zone */
  178.     BYTE smd_rt;        /* stepping pulse rate code */
  179. };
  180.  
  181.  
  182. /*
  183.  * Logical to physical device mapping table.
  184.  *
  185.  */
  186. #define LOGMAP struct _logmap
  187. LOGMAP {
  188.     int lm_physdev;        /* physical dev# (or -1) */
  189.     int lm_partno;        /* partition number on dev */
  190.     SECTOR lm_start;        /* physical starting block# of partition */
  191.     SECTOR lm_siz;            /* partition size */
  192. };
  193.